import LoginView from "../views/LoginView.vue";
import Dashboard from "../views/Dashboard.vue";
import { createRouter, createWebHistory} from "vue-router";
import UserView from "../views/user/UserView.vue";
import ActivityView from "../views/activity/ActivityView.vue";
import UserDetailView from "../views/user/UserDetailView.vue";
import UserAddView from "../views/user/UserAddOrUpdateView.vue";
import UserAddOrUpdateView from "../views/user/UserAddOrUpdateView.vue";
import ActivityAddOrUpdate from "../views/activity/ActivityAddOrUpdate.vue";
import ActivityDetailView from "../views/activity/ActivityDetailView.vue";
import ClueView from "../views/clue/ClueView.vue";
import ClueAddOrUpdateView from "../views/clue/ClueAddOrUpdateView.vue";
import ClueDetailView from "../views/clue/ClueDetailView.vue";
import StatisticsView from "../views/statictics/StatisticsView.vue";
import CustomerView from "../views/customer/CustomerView.vue";

const routes = [
    {
        // 跳转至登录页面
        path: '/',
        component: LoginView
    },
    {
        // 跳转至仪表盘页面即管理平台的主页面
        path: '/dashboard',
        component: Dashboard,
        // 配置子路由
        children: [
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: '',
                component: StatisticsView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'user',
                component: UserView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'user/detail/:userId',
                component: UserDetailView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'user/add',
                component: UserAddOrUpdateView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'user/edit/:userId',
                component: UserAddOrUpdateView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'activity',
                component: ActivityView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'activity/add',
                component: ActivityAddOrUpdate
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'activity/edit/:id',
                component: ActivityAddOrUpdate
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'activity/detail/:id',
                component: ActivityDetailView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'clue',
                component: ClueView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'clue/add',
                component: ClueAddOrUpdateView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'clue/edit/:id',
                component: ClueAddOrUpdateView
            },
            {
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'clue/detail/:id',
                component: ClueDetailView
            },{
                // 子路由的路由，注意注意：子路由的前面不可以加“/”
                path: 'customer',
                component: CustomerView
            }
        ]
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes,
})

export default router;

